跳转至

文章背景与核心概要

在构建树莓派集群或进行量产时,为多块树莓派计算模块(Compute Module)烧录操作系统镜像很快就会变成一项繁琐且重复的机械劳动。为了解决这一痛点,树莓派官方推出了售价 600 美元的 CM5 编程夹具(CM5 Programming Jig)。这是一款专为简化大规模配置而设计的硬件工具,它采用了“针床式”(bed of nails)弹簧针设计,并原生支持 rpi-sb-provisionerpi-gen 等管理工具。

尽管该设备对于普通爱好者来说价格偏高、难以触及,但对于需要部署数百甚至数千个 CM5 模块的小型企业和系统集成商而言,它提供了一种高效且具备工厂级别的解决方案。本文记录了作者对该硬件的实际上手体验,涵盖了从 pi-gen 镜像构建、本地 Web UI 配置到使用 rpi-sb-provisioner 进行生产数据库记录的全过程。


上手树莓派 CM5 编程夹具

发布于 2026年8月19日

摘要

Flashing OS images onto multiple Raspberry Pi Compute Modules for clusters or production builds can quickly become a tedious and repetitive chore. To solve this bottleneck, Raspberry Pi introduced the CM5 Programming Jig ($600), a hardware tool designed to streamline mass provisioning using a pogo-pin "bed of nails" and native management tools like rpi-sb-provisioner and pi-gen. While out of reach for casual hobbyists, this device offers an efficient, factory-grade solution for small businesses and systems integrators deploying hundreds or thousands of CM5 modules.


Raspberry Pi CM5 Programming Jig

在过去树莓派 CM5 还(相对)价格亲民的时期,我曾搭建过不少树莓派集群(例如这篇旧文),而整个搭建过程中最让人头疼的环节之一,就是给所有的树莓派刷写树莓派操作系统(Raspberry Pi OS)。

In the before-times, when Raspberry Pi CM5s were (relatively) affordable, I built a number of Pi clusters (example), and one of the most annoying parts of the build was flashing Raspberry Pi OS to all the Pis.

刷一两台甚至三台树莓派倒不是什么大问题,但一旦数量超过 4 台,流程就会变得极为繁琐:你需要把计算模块插到载板上、再把载板连上电脑、打开 Raspberry Pi Imager 进行管理,还得费劲去对齐主机名(hostname)、MAC 地址以及对应的物理树莓派本身。

One, two, or even three Pis isn't a big deal, but once you hit 4+, the process of plugging the Compute Module into a carrier board, plugging that into a computer, managing Raspberry Pi Imager, and trying to match up details like a hostname, MAC address, and the physical Pi itself, gets annoying.

虽然这些问题都能解决,但确实很烦人。

Solvable, but annoying.

好在树莓派现在提供解决方案了。这就是 CM5 编程夹具(如上图所示),他们送测了一个供我体验。

Raspberry Pi has a solution for that, now. It's the CM5 Programming Jig (pictured above), one of which they sent for testing.

由于本周日程安排非常紧凑,我只有几个小时的时间来熟悉它。虽然我还没能搭建起一条端到端的 CM5 完整镜像流水线,但大部分流程我已经跑通了。

Because of a tight schedule this week, I only got a few hours to get up to speed. I haven't gotten an end-to-end CM5 imaging line going, but I was able to get most of the way there.

CM5 编程夹具演示

Demo of the CM5 Programming Jig

如果你只想看简要总结(tl;dr),可以观看这段视频,里面包含开箱、完整演示以及更多背景信息:

For the tl;dr, you can watch the video with an unboxing, full demonstration, and more context here:

Video Embed Placeholder

但如果你喜欢阅读,那就跳过视频,继续往下看吧!

But if you enjoy reading, skip the video and carry on!

编程与测试夹具

Programming and Testing Jigs

在谈论树莓派官方的这款夹具(它与 EDAtec 合作开发)之前,我不得不提一下 Everypin 的 CM5 闪存夹具。它们在概念上高度相关,但 Everypin 的方案配合其开源 Python 库使用,售价高达 2200 欧元(约合 2500 美元)。

Before talking about Raspberry Pi's Jig (which was developed in tandem with EDAtec), I would be remiss not to mention Everypin's CM5 Flash Jig, which is very closely related, but works with Everypin's open source Python libraries and costs €2200 (about $2500 USD).

树莓派版本的夹具售价为 600 美元,开箱即可与树莓派自家的镜像/管理工具无缝配合,例如运行在夹具上的 rpi-sb-provisioner 以及 pi-gen

The Raspberry Pi version costs $600, and works out of the box with Raspberry Pi's own Pi imaging/management tools, like rpi-sb-provisioner (which runs on the Jig) and pi-gen.

Everypin 在记录 CM5 测试点他们自己的夹具方面做了非常出色的工作,但超过 2000 美元的高昂价格,让小型 CM5 量产项目很难将其列入预算。

Everypin did excellent work documenting the CM5 test points and their own Jig, but a price well over $2k makes it very difficult to justify for smaller CM5 production runs.

相比之下,树莓派官方版本虽然也不算便宜,但如果你是一家小型企业(甚至是工厂生产线),需要批量配置数百或数千个计算模块,那么这个价格就很容易接受了。

The Raspberry Pi version is relatively expensive, but easier to justify if you're a small business (or even factory production line) provisioning hundreds or thousands of Compute Modules.

准备编程夹具

Getting the Programming Jig Ready

树莓派官方已经提供了关于该编程夹具的文档,因此我不再赘述所有细节,其基本流程如下:

Raspberry Pi has documentation for the Programming Jig, so I won't rehash all that, but the basic process is:

  1. (假设夹具尚未刷机):使用 Raspberry Pi Imager 2.0.11 或更高版本将 Jig OS 刷入夹具。
  2. 使用 pi-gen 构建你自己的树莓派 .img 镜像。
  3. 通过夹具的本地 Web UI 进行配置。
  4. 开始逐个插入 CM5 进行刷机。
  1. (Assuming the Programming Jig is not already flashed): Flash Jig OS to the Jig using Raspberry Pi Imager 2.0.11 or later.
  2. Build your own Raspberry Pi .img images using pi-gen.
  3. Configure the Programming Jig via its local web UI.
  4. Start popping in CM5s to flash.

夹具上的 LED 灯将开始闪烁蓝光,几分钟后,当 CM5 烧录完成后,指示灯应切换为绿光。

The LED on the Jig will start flashing blue, and after a few minutes, when the CM5 is finished, it should switch to green.

使用 pi-gen 构建系统镜像

pi-gen to Build an OS Image

顺便提一句,当我在运行 macOS Tahoe 的 Mac 上尝试构建自己的树莓派系统镜像时,我运行了随附的 Docker 脚本,并需要切换到 pi-gen 软件的 arm64 分支。

Just as a note, when I tried building my own Pi OS image on my Mac running macOS Tahoe, I ran the included Docker script, and had to check out the arm64 branch of the pi-gen software.

以下是我用于生成镜像的 config 配置文件内容:

Here are the contents of my config file used for image generation:

RELEASE=trixie
ARCH=arm64
IMG_NAME="jeffpios-trixie"
PI_GEN_RELEASE="Jeff Geerling Pi OS"
USE_QEMU=0

# Account and SSH settings
FIRST_USER_NAME="jgeerling"
PASSWORDLESS_SUDO=1
ENABLE_SSH=1
PUBKEY_ONLY_SSH=1
PUBKEY_SSH_FIRST_USER="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA+PT1uOv/gmUyD+Dj++gQAMrmsXmGDtUesd1CrIRD1d jeff@macmini"

我生成了一个 Trixie 'Lite' 镜像,并通过 magic-wormhole 将其复制到了编程夹具上。

I generated a Trixie 'Lite' image and copied that over to the Programming Jig using magic-wormhole.

使用 rpi-sb-provisioner 配置 CM5

rpi-sb-provisioner to Provision the CM5s

该配置工具拥有独立的 Web UI,你可以用来监控 CM5 的刷机进度。它还会在本地制造数据库中记录所有成功的刷机运行,并包含有关 CM5 的 MAC 地址、序列号和硬件规格等信息。

The provisioner has its own web UI that you can use to monitor CM5 flashing progress. It will also log all successful runs in a local manufacturing database with information about the CM5's MAC address, serial number, and hardware specs.

Raspberry Pi Provisioner Manufacturing Database Screen

我想如何将这些数据输入到其他制造系统或标签打印工作流中,就全凭你的需求了。对于更大规模的运营,肯定会有更多用于上下料 CM5 的自动化设备。如果树莓派他们自己在自家的生产线上使用这套设备(或其某个版本),我也不会感到意外。

I guess it's up to you to feed that data into other manufacturing systems, labeling workflows, etc. And larger operations would certainly have more automation for loading and unloading CM5s. It wouldn't surprise me if Raspberry Pi themselves use this or a version of it in their own manufacturing lines.

Raspberry Pi CM4 Jig in Sony Factory

我知道多年前我参观索尼工厂时,他们就在研发 CM4 测试夹具(见上图),但当时使用的是较为脆弱的广濑(Hirose)连接器,这种连接器在插拔约 30 次后就无法保证信号完整性了。我完全可以想象,每天往这些连接器里塞一千个树莓派绝对会带来各种令人头疼的小故障!

I know they were working on CM4 test jigs years ago when I visited the Sony factory (see photo above), but it used the more fragile Hirose connectors, which are only rated for around 30 insertions before signal integrity is not guaranteed. I can imagine feeding a thousand Pis a day into those connectors was a recipe for annoying quirks!

相比之下,这款编程夹具采用了“针床式”设计(由一堆弹簧针组成),它们能够精准对准每个 CM5 底部的测试焊盘位置:

Instead, the Programming Jig has a 'bed of nails' (a bunch of pogo pins) which target test pad locations on the bottom of every CM5:

Raspberry Pi CM5 Programming Jig bed of nails

这种设计具备极高的可重复性,这也是我在参观他们工厂时看到用于 Pi 4 生产的同类设置。

Much more repeatable, and this is the same kind of setup I saw them using for Pi 4 production when I visited their factory.

结论

Conclusion

老实说,这并不是一个普通电子爱好者会觉得值得购买的东西,哪怕你管理着几个小型树莓派集群也是如此。但对于某些小型企业和系统集成商而言,这款 CM5 夹具将会极其有用。

Honestly, this is not something an individual tinkerer could justify buying, even if you manage a few small Pi clusters. But to some small businesses and systems integrators, the CM5 Jig will be immensely useful.

Raspberry Pi CM5 Programming Jig in use

如果未来 5 到 10 年内,你在二手工厂闲置设备中看到这些东西出现,请记住它们的内部其实还藏着一个你可以拆下来另作他用的 CM5 呢 :)

And in 5-10 years, if you start seeing these things show up in used factory surplus, know that they have a little CM5 tucked inside you could harvest :)


延伸阅读

Further Reading